using System;
using System.Collections.Generic;
using System.Text;
using ERP.BusinessEntities.Base;
using ERP.DAL.Factory;
using System.Data;
namespace ERP.BusinessEntities
{

	public class BSModuleMapingsController:BaseBusinessController
	{
		public BSModuleMapingsController()
		{
			dal = FactoryDal.CreateEndDal("BSModuleMapings");
		}

        public BSModuleMapingsInfo GetModuleMapingByTable(String strTable)
        {
            String strQuery = String.Format(@"SELECT * FROM BSModuleMapings
                                                WHERE TableName = '{0}'", strTable);

            DataSet ds = GetDataset(strQuery);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                return (BSModuleMapingsInfo)GetObjectFromDataRow(ds.Tables[0].Rows[0]);

            return null;

        }

        public BSModuleMapingsInfo GetModuleMapingByModule(String strModule)
        {
            String strQuery = String.Format(@"SELECT * FROM BSModuleMapings
                                                WHERE ModuleName = '{0}'", strModule);

            DataSet ds = GetDataset(strQuery);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                return (BSModuleMapingsInfo)GetObjectFromDataRow(ds.Tables[0].Rows[0]);

            return null;

        }
	}
}
